home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicFileChooserUI$BasicFileView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.4 KB  |  81 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.io.File;
  4. import java.util.Hashtable;
  5. import javax.swing.Icon;
  6. import javax.swing.filechooser.FileView;
  7.  
  8. public class BasicFileChooserUI$BasicFileView extends FileView {
  9.    // $FF: synthetic field
  10.    private final BasicFileChooserUI this$0;
  11.    protected Hashtable iconCache;
  12.  
  13.    public BasicFileChooserUI$BasicFileView(BasicFileChooserUI var1) {
  14.       this.this$0 = var1;
  15.       this.iconCache = new Hashtable();
  16.    }
  17.  
  18.    public void cacheIcon(File var1, Icon var2) {
  19.       if (var1 != null && var2 != null) {
  20.          this.iconCache.put(var1, var2);
  21.       }
  22.    }
  23.  
  24.    public void clearIconCache() {
  25.       this.iconCache = new Hashtable();
  26.    }
  27.  
  28.    public Icon getCachedIcon(File var1) {
  29.       return (Icon)this.iconCache.get(var1);
  30.    }
  31.  
  32.    public String getDescription(File var1) {
  33.       return var1.getName();
  34.    }
  35.  
  36.    public Icon getIcon(File var1) {
  37.       Icon var2 = this.getCachedIcon(var1);
  38.       if (var2 != null) {
  39.          return var2;
  40.       } else {
  41.          if (var1 != null && var1.isDirectory()) {
  42.             if (this.this$0.getFileChooser().getFileSystemView().isRoot(var1)) {
  43.                var2 = this.this$0.hardDriveIcon;
  44.             } else {
  45.                var2 = this.this$0.directoryIcon;
  46.             }
  47.          } else {
  48.             var2 = this.this$0.fileIcon;
  49.          }
  50.  
  51.          this.cacheIcon(var1, var2);
  52.          return var2;
  53.       }
  54.    }
  55.  
  56.    public String getName(File var1) {
  57.       String var2 = null;
  58.       if (var1 != null) {
  59.          var2 = var1.getName();
  60.          if (var2.equals("")) {
  61.             var2 = var1.getPath();
  62.          }
  63.       }
  64.  
  65.       return var2;
  66.    }
  67.  
  68.    public String getTypeDescription(File var1) {
  69.       return var1.isDirectory() ? BasicFileChooserUI.access$2(this.this$0) : BasicFileChooserUI.access$3(this.this$0);
  70.    }
  71.  
  72.    public Boolean isHidden(File var1) {
  73.       String var2 = var1.getName();
  74.       return var2 != null && var2.charAt(0) == '.' ? Boolean.TRUE : Boolean.FALSE;
  75.    }
  76.  
  77.    public Boolean isTraversable(File var1) {
  78.       return var1.isDirectory() ? Boolean.TRUE : Boolean.FALSE;
  79.    }
  80. }
  81.